<style src="./index.scss" lang="scss" scoped rel="stylesheet/scss"></style>
<template src="./index.html"></template>

<script>
export default {
  mixins: [Vue.prototype.$vFN.Mixins.Base],
  data() {
    return {
      // item_id: null,
      title: "放款选择",
      // 窗口显示
      boxVisible: false,
      // 页面接口地址
      apiUrl: {
        payment: "mall-site-portal/member-money-withdraw/payment",
        succeedPayment: "mall-site-portal/member-money-withdraw/succeedPayment",
        rejectPayment: "mall-site-portal/member-money-withdraw/rejectPayment",
        huijuPayment: "mall-site-portal/member-money-withdraw/huijuPayment",
      },
      // 用户选择
      radio: 1,
    };
  },
  methods: {
    // 确定
    async submit() {
      let _url;
      switch (this.radio) {
        case 1:
          _url = this.apiUrl.payment;
          break;
        case 2:
          _url = this.apiUrl.huijuPayment;
          break;
        case 3:
          _url = this.apiUrl.succeedPayment;
          break;
        case 4:
          _url = this.apiUrl.rejectPayment;
          break;
      }

      let _data = await this.$vFN.Http.post(
        {
          url: _url,
          data: {
            id: this.id, //从上一级传来
          },
        },
        window
      );

      if (_data._ok) {
        this.$vFN.Tools.messageSuccess("提交成功");
        this.onSuccess();
        this.boxVisible = false;
      }
    },
    // 关闭窗口
    editBoxClose() {
      this.boxVisible = false;
      this.onCancel();
    },
    // 取消
    editBoxCancel() {
      this.editBoxClose();
    },
  },

  async mounted() {
    this.boxVisible = true;
    this.radio = this.type;
  },
};
</script>

